package com.weme.common.viewmodel

import android.util.Log
import com.weme.common.base.BaseViewModel
import com.weme.common.network.NetWorkUrl
import dev.kratos.api.im_server.v1.*
import dev.kratos.api.user_server.v1.GetAlbumRequest
import dev.kratos.api.user_server.v1.GetUserInfoRequest
import java.lang.Deprecated

class CallViewMode : BaseViewModel() {

    fun setMatchCancel() {
        sendImNetworkRequest(MatchCancelRequest.newBuilder().build().toByteArray(), NetWorkUrl.MatchCancelRequest)
    }

    fun setMatchAnswer() {
        sendImNetworkRequest(MatchAnswerRequest.newBuilder().build().toByteArray(), NetWorkUrl.MatchAnswerRequest)
    }

    fun setHangUp(uid: Long) {
        sendImNetworkRequest(HangUpVideoRequest.newBuilder().setToUid(uid).build().toByteArray(), NetWorkUrl.HangUpVideo)
    }

    fun setCancelCall(channelName:String,uid: Long){
        Log.e("tag",channelName)
        sendImNetworkRequest(CancelCallRequest.newBuilder().setChannelName(channelName).setToUid(uid).build().toByteArray(),NetWorkUrl.CancelCall)
    }

    fun setHangUp(uid: Long,channelName: String) {
        sendImNetworkRequest(HangUpVideoRequest.newBuilder().setToUid(uid).setChannelName(channelName).build().toByteArray(), NetWorkUrl.HangUpVideo)
    }

    fun callVideo(uid: Long) {
        sendImNetworkRequest(CallVideoRequest.newBuilder().setToUid(uid).build().toByteArray(), NetWorkUrl.CallVideo)
    }

    fun setAnswerVideo(uid :Long,channelName:String) {
        sendImNetworkRequest(AnswerVideoRequest.newBuilder().setToUid(uid).setChannelName(channelName).build().toByteArray(), NetWorkUrl.AnswerVideo)
    }



    fun getCallUserInfo(req: GetUserInfoRequest) {
        val reqByte = req.toByteArray()
        sendNetworkRequest(reqByte, NetWorkUrl.GetCallUserInfo)
    }


    fun getAlbum(req: GetAlbumRequest) {
        val reqByte = req.toByteArray()
        sendNetworkRequest(reqByte, NetWorkUrl.CallGetAlbum)
    }
    fun getRefuseVideo(req: RefuseVideoRequest) {
        val reqByte = req.toByteArray()
        sendImNetworkRequest(reqByte, NetWorkUrl.RefuseVideo)
    }

    fun getChannelInfo() {
        sendImNetworkRequest(GetChannelInfoRequest.newBuilder().build().toByteArray(), NetWorkUrl.CallGetChannelInfo)
    }
}